<div id="content-box">
		<div class="border">
			<div class="padding">
				<div id="toolbar-box">
   			<div class="t">
				<div class="t">
					<div class="t"></div>
				</div>
			</div>
			<div class="m">
				<div class="toolbar" id="toolbar">
<table class="toolbar"><tr>
<td class="button" id="toolbar-save">
<a href="#" onclick="javascript: submitbutton('save')" class="toolbar">
<span class="icon-32-save" title="Save">
</span>
Lưu và thoát
</a>
</td>

<td class="button" id="toolbar-apply">
<a href="#" onclick="javascript: submitbutton('apply')" class="toolbar">
<span class="icon-32-apply" title="Apply">
</span>
Lưu
</a>
</td>

<td class="button" id="toolbar-cancel">
<a href="#" onclick="javascript: submitbutton('cancel')" class="toolbar">
<span class="icon-32-cancel" title="Cancel">
</span>
Hủy
</a>
</td>

<td class="button" id="toolbar-help">
<a href="#" onclick="popupWindow('', 'Help', 640, 480, 1)" class="toolbar">
<span class="icon-32-help" title="Help">
</span>
Trợ gíup
</a>
</td>

</tr></table>
</div>
				<div class="header icon-48-menu">
Chỉnh sửa một mục menu: <small><small>[ Bài viết ]</small></small>
</div>

				<div class="clr"></div>
			</div>
			<div class="b">
				<div class="b">
					<div class="b"></div>
				</div>
			</div>
  		</div>
   		<div class="clr"></div>
				
		<div id="element-box">
			<div class="t">
		 		<div class="t">
					<div class="t"></div>
		 		</div>
			</div>
			<div class="m">
				
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.phpForm;

	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}
	if (trim( form.title.value ) == ""){
		alert( "Bạn phải nhập tiêu đề cho item" );
		form.title.focus();
		return;
	} else {
		submitform( pressbutton );
	}
}
//-->
</script>
<form method="post" name="phpForm">
<?php
	include("../protected/dbconnect.php");
	$sql = "SELECT `menu`.`parent_Id`, `menu`.`title`, `menu`.`activated`, `menu`.`active_title`, `menu`.`active_date`, `menu`.`order_num`, `menu`.`link`, `menu`.`link_id`, `menu`.`type`, `menu`.`target`, `menu`.`Id`  
			FROM `menu`
			WHERE `menu`.`Id` = ?";
	$cmd = $mysqli->prepare($sql);
	$cmd->bind_param("s", $_GET["id"]);
	$cmd->execute();
	$cmd->bind_result($parent_id, $title, $activated, $active_title, $active_date, $order_num, $link, $link_id, $type, $target, $Id);
	if($cmd->fetch()){
?>
	<table class="admintable" width="100%">
		<tr valign="top">
			<td width="60%">
				<!-- Menu Item Type Section -->
				<fieldset>
					<legend>Kiểu của mục menu</legend>
					<div style="float:right">
						<button type="button" onClick="javascript:void(0)">Thay đổi loại</button>
					</div>
					<h2>Giao diện chỉnh sửa mục menu bài viết</h2>
				</fieldset>
				<!-- Menu Item Details Section -->
				<fieldset>
					<legend>Chi tiết của danh mục Menu</legend>
					<table width="100%">
												<tr>
							<td class="key" align="right">
								Tiêu đề:
							</td>
							<td>
								<input class="inputbox" type="text" name="title" size="50" maxlength="255" value="<?php echo $title; ?>" />
							</td>
						</tr>						
						<tr>
							<td class="key" align="right">
								Liên kết:
							</td>
							<td>
								<input class="inputbox" type="text" name="disable_link" size="50" maxlength="255" value="<?php echo $link; ?>" disabled="disabled" />
								<input type="hidden" name="link" value="<?php echo $link; ?>" />
							</td>
						</tr>
						<tr>
							<td class="key" align="right">
								Bản tin cần liên kết:
							</td>
							<td>
							<?php include("../protected/dbconnect.php");
								$sql = "SELECT `news`.`Title` FROM `news` WHERE `news`.`alias` = ?";
								$cmd = $mysqli->prepare($sql);
								$cmd->bind_param("s", $link_id);
								$cmd->execute();
								$cmd->bind_result($title);
								if($cmd->fetch()){?>
									<div style="float: left;">
									<input style="background: #ffffff;" type="text" id="id_name" value="<?php echo $title; ?>" disabled="disabled" />
									</div>
									<div class="button2-left">
										<div class="blank">
										<a class="modal" title="Chọn một bài viết"  href=".?com=com_menu&view=item_menu&task=article.choose" rel="{handler: 'iframe', size: {x: 750, y: 550}}">Lựa chọn</a>
										</div>
									</div>
									<input type="hidden" id="id_id" name="newsid" value="<?php echo $link_id; ?>" />
							<?php } ?>
							</td>
						</tr>
						<tr>
							<td class="key" align="right">
								Hiển thị trong:
							</td>
							<td>
								<select name="menutype" id="menutype" class="inputbox" size="1">
								  <?php
									include("../protected/dbconnect.php");
									$sql = "SELECT `menu_type`.`Id`, `menu_type`.`title` FROM `menu_type` WHERE `menu_type`.`Id` = ?";
									$cmd = $mysqli->prepare($sql);
									$cmd->bind_param("s", $_GET["menutypeid"]);
									$cmd->execute();
									$cmd->bind_result($Id, $title);
									while($cmd->fetch()){
										echo "<OPTION value=$Id>$title</OPTION>";
									}									
								  ?>
								</select>
							</td>
						</tr>
						<tr>
							<td class="key" align="right">
								Hiển thị tiêu đề bài viết:
							</td>
							<td>
								<?php if($active_title == 1){?>
								<input type="radio" name="publish_title" id="title0" value="1" checked="checked" />
								<label for="title0">Yes</label>
								<input type="radio" name="publish_title" id="title1" value="0" />
								<label for="title1">No</label>
								<?php } else {?>
								<input type="radio" name="publish_title" id="title0" value="1" />
								<label for="title0">Yes</label>
								<input type="radio" name="publish_title" id="title1" value="0" checked="checked" />
								<label for="title1">No</label>
								<?php } ?>
							</td>
						</tr>
						<tr>
							<td class="key" align="right">
								Hiển thị ngày đăng tin:
							</td>
							<td>
								<?php if($active_date == 1){?>
								<input type="radio" name="publish_date" id="date0" value="1" checked="checked"  />
								<label for="date0">Yes</label>
								<input type="radio" name="publish_date" id="date1" value="0" />
								<label for="date1">No</label>
								<?php } else {?>
								<input type="radio" name="publish_date" id="date0" value="1" />
								<label for="date0">Yes</label>
								<input type="radio" name="publish_date" id="date1" value="0" checked="checked" />
								<label for="date1">No</label>
								<?php } ?>
								
							</td>
						</tr>
						<tr>
							<td class="key" align="right" valign="top">
								Item cha:
							</td>
							<td>
							<select name="parent" id="parent" class="inputbox" size="20">
							<option value="0"  selected="selected">Root</option>
							<?php								
								include("../protected/dbconnect.php");
								$sql = "SELECT `menu`.`Id`, `menu`.`title` FROM `menu` where parent_Id = 0 AND `menu`.`menu_type_id` = ?";
								$cmd = $mysqli->prepare($sql);
								$cmd->bind_param("s", $_GET["menutypeid"]);
								$cmd->execute();
								$cmd->bind_result($Id, $title);
								$cmd->store_result();
								$sub_space = "&nbsp;&nbsp;&nbsp;|";
								$sub_sign = "_";								
								while($cmd->fetch()){
									if($Id == $parent_id){
										echo "<option value=$Id selected=selected> $sub_space $sub_sign $title </option>";
									} else {
										echo "<option value=$Id> $sub_space $sub_sign $title </option>";
									}
									loadsubmemu($parent_id, $Id, $sub_space, $sub_sign);
								}								
							?>
							</select>							
							</td>
						</tr>
						<tr>
							<td class="key" valign="top" align="right">
								Đã được bật:
							</td>
							<td>
								<input type="radio" name="published" id="published0" value="0"  />
								<label for="published0">No</label>
								<input type="radio" name="published" id="published1" value="1" checked="checked"  />
								<label for="published1">Yes</label>
							</td>
						</tr>
						<tr>
							<td class="key" valign="top" align="right">
								Thứ tự:
							</td>
							<td>Mặc định các danh mục mới ở vị trí cuối cùng. Thứ tự có thể thay đổi sau khi danh mục này được lưu. </td>
						</tr>						
						<tr>
							<td class="key" valign="top" align="right">
								Khi click chuột, mở ra tại: 
							</td>
							<td>
								<select name="browserNav" id="browserNav" class="inputbox" size="3">
								<option value="_self"  selected="selected">Hiển thị trong cửa sổ đang xem</option>
								<option value="_blank" >Hiển thị trong cửa sổ mới</option>
								</select>
							</td>
						</tr>
					</table>
				</fieldset>
			</td>			
		</tr>
	</table>
	<input type="hidden" name="hidden" value="submit_com_menu_item_menu_article_edit" />
	<input type="hidden" name="menuid" value="<?php echo $_GET["id"]?>" />
	<input type="hidden" name="task"/>
	<?php } ?>
	</form>
	<?php 
		function loadsubmemu($parend_id, $id, $sub_space, $sub_sign ){
			include("../protected/dbconnect.php");
			$sql1 = "SELECT `menu`.`Id`, `menu`.`title` FROM `menu` where parent_Id = $id AND `menu`.`menu_type_id` = ?";
			$cmd1 = $mysqli->prepare($sql1);
			$cmd1->bind_param("s", $_GET["menutypeid"]);
			$cmd1->execute();
			$cmd1->bind_result($sub_Id, $sub_title);
			$cmd1->store_result();
			if($cmd1->num_rows > 0){
				$sub_space = $sub_space . "&nbsp;&nbsp;&nbsp;|";
				$sub_sign = $sub_sign . "_";
				while($cmd1->fetch()){
					if($sub_Id == $parend_id){
						echo "<option value=$sub_Id selected=selected> $sub_space $sub_sign $sub_title </option>";
					} else {
						echo "<option value=$sub_Id> $sub_space $sub_sign $sub_title </option>";
					}
					loadsubmemu($parend_id, $sub_Id, $sub_space, $sub_sign);											
				}
			}
		}
	?>
				<div class="clr"></div>
			</div>
			<div class="b">
				<div class="b">
					<div class="b"></div>
				</div>
			</div>
   		</div>
		<noscript>
			Warning! JavaScript must be enabled for proper operation of the Administrator Back-end		</noscript>
		<div class="clr"></div>
	</div>
	<div class="clr"></div>
</div>
</div>
	<div id="border-bottom"><div><div></div></div></div>